package com.djp.computerServer.controller;

import com.djp.computerServer.bean.Package;
import com.djp.computerServer.service.PackageService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/package")
public class PackageController extends BaseController<PackageService>{
    @RequestMapping("/add")
    @ResponseBody
    public Map addPackage(@RequestBody Package Package) {
        return buildMap("增加套餐", service.add(Package));
    }

    @RequestMapping("/delete")
    @ResponseBody
    public Map delPackage(@RequestBody Package Package) {
        return buildMap("删除套餐", service.delete(Package));
    }

    @RequestMapping("/update")
    @ResponseBody
    public Map updatePackage(@RequestBody Package Package) {
        return buildMap("更新套餐", service.add(Package));
    }

    @RequestMapping("/getAll")
    @ResponseBody
    public Map getAllPackage() {
        return buildMap("获取全部套餐", service.getAll());
    }

    @RequestMapping("/getOne")
    @ResponseBody
    public Map getOnePackage(@RequestBody Package Package) {
        return buildMap("获取一个套餐", service.getOne(Package));
    }
}
